<template>
	<view style="height: 100vh;background: url('https://love-space.oss-cn-chengdu.aliyuncs.com/uploads/20220907/e6d25f7ddd3477af4a7f2142d5e1045e.jpg'); background-size: 100% 100%;color: #fff;">
		<view class="flex a-t j-t" style="min-height: 350rpx;">
			<image :src="vuex_user_content.my_avatar" mode="widthFix" style="width: 60px;border-radius: 50%;margin-right: -10px;"></image>
			<image :src="vuex_user_content.ta_avatar ? vuex_user_content.ta_avatar : vuex_user_content.my_avatar" mode="widthFix" style="width: 60px;border-radius: 50%;"></image>
		</view>
		<view style="text-align: center;">
			-仅供娱乐-
		</view>
		<view v-if="type==0" style="text-align: center;box-sizing: border-box;padding: 10px;">
			假如我们都<text class="b1">活到100岁</text>，还能在一起<text class="b1">{{num}}</text>天
		</view>
		<view style="text-align: center;">
			-未来的
			<text v-if="type==0">我们</text>
			<text v-if="type==1">Ta</text>
			<text v-if="type==2">我</text>
			还可以-
		</view>
		<view v-for="(item,index) in list" class="flex a-t" style="box-sizing: border-box;padding: 10px;">
			<image src="https://yunkeososyunchuc.bc8t.cn/lianaikongjian/static/xin1.png" mode="widthFix" style="width: 20px;margin-right: 6px;"></image>
			{{item.t1}}{{item.num}}{{item.t2}}
		</view>
		<view @click="baogao" style="position: fixed;z-index: 1;width: 80%;border-radius: 30px;bottom: 20px;left: 10%;text-align: center;line-height: 36px;" class="button cfff">
			{{text}}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				num:0,
				type:0,
				list:[

				],
				text:'未来的Ta'
			}
		},
		onLoad(e) {
			uni.setNavigationBarColor({
			    frontColor: '#000000',
			    backgroundColor: '#ffffff',
			})
			this.type=e.type
			if(this.type==0){
				// type=1
				this.text='未来的我'
			}
			if(this.type==1){
				// type=2
				this.text='未来的Ta'
			}
			if(this.type==2){
				// type=0
				this.text='未来的我们'
			}
			console.log(this.vuex_time,this.vuex_user_content)
			this.getday()
		},
		methods: {
			baogao(){
				let type=''
				if(this.type==0){
					type=1
					// this.text='未来的Ta'
				}
				if(this.type==1){
					type=2
					// this.text='未来的我'
				}
				if(this.type==2){
					type=0
					// this.text='未来的我们'
				}
				uni.navigateTo({
					url:'/pages/weilai/detail?type='+type
				})
			},
			getday(){
				if(this.type==0){
					this.list=[
						{
							t1:'一起吃',
							num:0,
							t2:'顿饭'
						},
						{
							t1:'一起过',
							num:0,
							t2:'个周末'
						},
						{
							t1:'亲吻',
							num:0,
							t2:'次'
						},
						{
							t1:'拥抱',
							num:0,
							t2:'次'
						},
						{
							t1:'吵',
							num:0,
							t2:'次架'
						},
						{
							t1:'拌',
							num:0,
							t2:'嘴'
						},
						{
							t1:'为爱流',
							num:0,
							t2:'次眼泪'
						},
						{
							t1:'有',
							num:0,
							t2:'次想离开对方'
						},
						{
							t1:'有',
							num:0,
							t2:'次希望永远在一起'
						}
					]
				}
				if(this.type==1||this.type==2){
					this.list=[
						{
							t1:'幸福的睡',
							num:0,
							t2:'次觉'
						},
						{
							t1:'愉快的洗',
							num:0,
							t2:'次脚'
						},
						{
							t1:'畅快的放',
							num:0,
							t2:'个屁'
						},
						{
							t1:'幸运的做',
							num:0,
							t2:'个梦'
						},
						{
							t1:'习惯的眨',
							num:0,
							t2:'次眼'
						},
						{
							t1:'大胆的说',
							num:0,
							t2:'次慌'
						},
						{
							t1:'悠闲的剪',
							num:0,
							t2:'次指甲'
						},
						{
							t1:'大口的喝',
							num:0,
							t2:'杯水'
						},
						{
							t1:'懒懒的伸',
							num:0,
							t2:'个懒腰'
						},
						{
							t1:'欢快的打',
							num:0,
							t2:'次哈欠'
						}
					]
				}
				var date = new Date();
				let y=date.getFullYear()
				// console.log()
				var d=0
				if(this.type==0){

					if(parseInt(this.vuex_time.y1.split('-')[0])-parseInt(this.vuex_time.y1.split('-')[0])>=0){
						d=this.vuex_time.y1
					}else{
						d=this.vuex_time.y2
					}
				}
				if(this.type==1){
					d=this.vuex_time.y1
				}
				if(this.type==2){
					d=this.vuex_time.y2
				}
				let data=[
					1,2,3,4
				]
				let d1=[
					'*',"/"
				]
				let d2=Math.round(Math.random())
				let d3=Math.floor(Math.random()*4);
				this.num=(100-(y-parseInt(d)))*365
				if(this.type==0){
					this.list[0].num=this.num*3
					this.list[1].num=Math.ceil(this.num/7)
				}else{
					this.list[0].num=this.num
					this.list[1].num=this.num
					if(d1[Math.round(Math.random())]=='*'){
						this.list[9].num=Math.ceil(this.num*data[Math.floor(Math.random()*4)])
					}else{
						this.list[9].num=Math.ceil(this.num/data[Math.floor(Math.random()*4)])
					}

				}

				if(d1[Math.round(Math.random())]=='*'){
					this.list[2].num=Math.ceil(this.num*data[Math.floor(Math.random()*4)])
					this.list[3].num=Math.ceil(this.num*data[Math.floor(Math.random()*4)])
					this.list[4].num=Math.ceil(this.num*data[Math.floor(Math.random()*4)])
					this.list[5].num=Math.ceil(this.num*data[Math.floor(Math.random()*4)])
					this.list[6].num=Math.ceil(this.num*data[Math.floor(Math.random()*4)])
					this.list[7].num=Math.ceil(this.num*data[Math.floor(Math.random()*4)])
					this.list[8].num=Math.ceil(this.num*data[Math.floor(Math.random()*4)])
				}else{
					this.list[2].num=Math.ceil(this.num/data[Math.floor(Math.random()*4)])
					this.list[3].num=Math.ceil(this.num/data[Math.floor(Math.random()*4)])
					this.list[4].num=Math.ceil(this.num/data[Math.floor(Math.random()*4)])
					this.list[5].num=Math.ceil(this.num/data[Math.floor(Math.random()*4)])
					this.list[6].num=Math.ceil(this.num/data[Math.floor(Math.random()*4)])
					this.list[7].num=Math.ceil(this.num/data[Math.floor(Math.random()*4)])
					this.list[8].num=Math.ceil(this.num/data[Math.floor(Math.random()*4)])
				}

			},
		}
	}
</script>

<style>
page{
	background: #fff;
}
	image{
		height: auto;
	}
</style>
